import React from 'react';
import { Route, IndexRoute} from 'react-router';

const App =  (location, callback) => {
  require.ensure([], require => {
    callback(null, require('../components/App').default)
  })
};


import * as  index from '../components/home/index';
import * as  admin from '../components/admin/index';

export default  (
    <Route path="/"  getComponent={App}>
      <IndexRoute getComponent={index.home}/>
      <Route path="content/:id" getComponent={index.content}/>
      {/*后端*/}
      <Route path="admin" getComponent={admin.home}>
        <IndexRoute getComponent={admin.base}/>
        <Route path="base" getComponent={admin.base}/>
        <Route path="list" getComponent={admin.list}/>
        <Route path="add" getComponent={admin.add}/>
        <Route path="edit/:id" getComponent={admin.edit}/>
        <Route path="class">
          <IndexRoute getComponent={admin.classList}/>
          <Route path="list" getComponent={admin.classList}/>
          <Route path="add" getComponent={admin.classAdd}/>
          <Route path="edit/:id" getComponent={admin.classEdit}/>
        </Route>
      </Route>
    </Route>
);

